import java.util.Scanner;

public class pingweidafen {
    public static void main(String[] args) {
        int[] Scoresarr = getscores();
        for (int i = 0; i < Scoresarr.length; i++) {
            System.out.println("第" + (i+1) + "位评委评分为" + Scoresarr[i]);
        }
        int max = max(Scoresarr);
        int min = min(Scoresarr);
        int sum = sum(Scoresarr);
        int score =(sum-max-min)/(Scoresarr.length-2);
        System.out.println("抹去最高分和最低分后求平均，你的成绩为"+score);
    }

    public static int[] getscores() {
        int[] scoresarr = new int[6];
        Scanner sc = new Scanner(System.in);
        for (int i = 0; i < scoresarr.length; ) {
            System.out.println("输入评委的打分");
            int tmp =sc.nextInt();
            if (tmp > 0 && tmp < 100) {
                scoresarr[i] = tmp;
                i++;
            } else {
                System.out.println("超出范围，输入正确数字，当前为第" + i + "位评委分数");
            }
        }
        return scoresarr;
    }

    public static int max(int[] Scoresarr) {
        int max = Scoresarr[0];
        for (int j : Scoresarr) {
            if (j > max) {
                max = j;
            }
        }
        return max;
    }

    public static int min(int[] Scoresarr) {
        int min = Scoresarr[0];
        for (int j : Scoresarr) {
            if (j < min) {
                min = j;
            }
        }
        return min;
    }

    public static int sum(int[] Scoresarr) {
        int sum = 0;
        for (int j : Scoresarr) {
            sum = sum + j;
        }
        return sum;
    }
}